#include<iostream>
#include<cstring>
using namespace std;
const int N = 2e3 + 10, M = N * N;
int h[N], e[M], ne[M], idx;
int st[N];
int w[N];
int n;
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
bool dfs(int u, int d, int fa)
{
	st[u] = d;
	for (int i = h[u]; ~i; i = ne[i]) {
		int j = e[i];
		if (j == fa)continue;
		if (st[j]) {
			if (st[j] == d)return 0;
			else continue;
		}
		else dfs(j, 3 - d, u);
	}
	return 1;
}
int main()
{
	while (cin >> n) {
		memset(h, -1, sizeof(h));
		memset(ne, 0, sizeof(ne));
		memset(e, 0, sizeof(e));
		memset(st, 0, sizeof(st));
		memset(w, 0, sizeof(w));
		idx = 0;
		for (int i = 1; i <= n; i++) {
			cin >> w[i];
			//cout << "w[i]==" << w[i] << endl;
		}
		for (int i = 1; i <= n - 1; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (w[i] >= w[j]) {
					add(i, j);
					add(j, i);
				}
			}
		}
		bool flag = 0;
		for (int i = 1; i <= n; i++) {
			if (!st[i]) {
				if (!dfs(i, 1, 0)) {
					flag = 1;
					break;
				}
			}
		}
		if (flag)cout << "No!" << endl;
		else cout << "Yes!" << endl;
	}
	return 0;
}